﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------

using System.Collections.Generic;

namespace GameFramework.Entity
{
    public sealed partial class EntityManager //: GameFrameworkModule, IEntityManager
    {
        /// <summary>
        /// 实体信息。
        /// </summary>
        private sealed class ModelInstanceInfo : AbstractReference
        {
            private ShowEntityInfo m_ShowEnitiyInfo;
            private string m_EntityAssetName;
            private bool m_IsNewInstance;
            private float m_Duration;
            private object m_EntityAsset;
            public ShowEntityInfo ShowEnitiyInfo
            {
                get
                {
                    return m_ShowEnitiyInfo;
                }
                set
                {
                    m_ShowEnitiyInfo = value;
                }
            }

            public object EntityAsset
            {
                get
                {
                    return m_EntityAsset;
                }
                set
                {
                    m_EntityAsset = value;
                }
            }

            public string EntityAssetName
            {
                get
                {
                    return m_EntityAssetName;
                }
                set
                {
                    m_EntityAssetName = value;
                }
            }

           
            public bool IsNewInstance
            {
                get
                {
                    return m_IsNewInstance;
                }
                set
                {
                    m_IsNewInstance = value;
                }
            }
            public float Duration
            {
                get
                {
                    return m_Duration;
                }
                set
                {
                    m_Duration = value;
                }
            }
           
            public ModelInstanceInfo()
            {
                m_EntityAssetName = "";
                m_IsNewInstance = false;
                m_Duration = 0;
                m_ShowEnitiyInfo = null;
                m_EntityAsset = null;
            }

           

            public static ModelInstanceInfo Create(ShowEntityInfo showEntityInfo, string entityAssetName, object entityAsset, bool isNewInstance, float duration)
            {
                ModelInstanceInfo modelInstanceInfo = ReferencePool.Acquire<ModelInstanceInfo>();
                modelInstanceInfo.ShowEnitiyInfo = showEntityInfo;
                modelInstanceInfo.m_EntityAssetName = entityAssetName;
                modelInstanceInfo.m_IsNewInstance = isNewInstance;
                modelInstanceInfo.m_Duration = duration;
                modelInstanceInfo.m_EntityAsset = entityAsset;
                return modelInstanceInfo;
            }

            public override void Clear()
            {
                ShowEnitiyInfo = null;
                m_EntityAssetName = "";
                m_IsNewInstance = false;
                m_Duration = 0;
                m_EntityAsset = null;
            }

        }
    }
}

